﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using BadmintonApp.Entity;
using BadmintonApp.Factory;
using BadmintonApp.BLL.Interface;
using BadmintonApp.DAO.Interface;

namespace BadmintonApp.BLL.Implement
{
    public class RoleBLL : IRoleBLL
    {
        private IRoleDAO dao;

        /// <summary>
        /// 默认的构造函数
        /// </summary>
        public RoleBLL()
        {
            dao = DaoFactory.CreateRoleDAO();
        }

        #region IRoleBLL Members

        /// <summary>
        /// 插入角色信息
        /// </summary>
        /// <param name="rolesInfo">角色信息类</param>
        public void InsertRole(TRolesInfo rolesInfo)
        {
            dao.InsertRole(rolesInfo);
        }

        /// <summary>
        /// 更新角色信息
        /// </summary>
        /// <param name="rolesInfo">角色信息类</param>
        public void UpdateRole(TRolesInfo rolesInfo)
        {
            dao.UpdateRole(rolesInfo);
        }

        /// <summary>
        /// 删除角色信息
        /// </summary>
        /// <param name="roleID">角色ID</param>
        public void DeleteRole(int roleID)
        {
            dao.DeleteRole(roleID);
        }

        /// <summary>
        /// 获取所有角色信息
        /// </summary>
        /// <returns></returns>
        public DataSet GetAllRoles()
        {
            return dao.GetAllRoles();
        }

        /// <summary>
        /// 根据名称获取角色信息
        /// </summary>
        /// <param name="roleName">角色名称</param>
        /// <returns>角色信息类</returns>
        public TRolesInfo GetRoleByName(string roleName)
        {
            return dao.GetRoleByName(roleName);
        }

        #endregion
    }
}
